<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return $router->app->version();
});

// 获取token
$router->post('/auth/login', 'AuthController@postLogin');

// 刷新token
$router->post('/auth/updateToken','AuthController@updateToken');

// 获取用户信息
$router->group(['middleware' => 'auth:api'], function($router) {
    $router->get('/auth/user', 'AuthController@getUser');
});

// 缓存测试
$router->group(['prefix' => 'cach/v1','middleware' => 'auth:api'], function($router)
{
    // Redis
    $router->get('redis','testController@redis');
    // Memcached
    $router->get('memcached','testController@memcached');
    // CMQ
    $router->get('cmq','testController@cmq');
});

// 地图小工具
$router->group(['prefix' => 'map/v1','middleware' => 'auth:api'], function($router)
{
    // 地址转经纬度
    $router->get('latlng','MapController@getLatLngByAddres');
    // 经纬度转地址
    $router->get('addres','MapController@getAddressByLngLat');
    // 坐标系转换接口
    $router->get('coordinateSwitch','MapController@getCoordinate');
    // ip定位接口
    $router->get('getCityByIP','MapController@getCityByIP');
});

// 聚合数据API实用工具
$router->group(['prefix' => 'juhe/v1','middleware' => 'auth:api'], function($router)
{
    // 获取周边WiFi热点信息--根据经纬度
    $router->get('getNearbyWifiByLngLat','JuheController@getNearbyWifiByLngLat');
    // 获取周边WiFi热点信息--根据城市名
    $router->get('getNearbyWifiByCity','JuheController@getNearbyWifiByCity');
});